# -*- coding: utf-8 -*-
import pygame
import random
BLACK = (0,0,0)
WHITE = (255,255,255)
RED=(255,0,0)
pygame.init()
screen = pygame.display.set_mode([800,575])
clock = pygame.time.Clock()
pygame.display.set_caption("Familiarity with the keyboard")
count_appear = 0
count_true = 0
font = pygame.font.SysFont("Times", 30)
pic = pygame.image.load("laoshu1.png")
background= pygame.image.load("beijing.jpg")
keep_going = True
while keep_going :
    for event in pygame.event.get():
        if event.type==pygame.QUIT:
            keep_going = False
        if event.type==pygame.KEYDOWN:
            if event.key==correct_answer1:#game loop
                count_true+=1
    #添加背景和老鼠
    screen.blit(background, (0,0))
    screen.blit(pic,(325,250))
    #产生随机数并赋值到屏幕老鼠
    correct_answer1=random.randint(97,122)
    count_appear+=1
    m= font.render(str(chr(correct_answer1)),True, RED)
    screen.blit(m,(400,350))
    #显示文字
    draw_string0 = "appear: " +str(count_appear)
    draw_string1= " true: " +str(count_true)
    text0 = font.render(draw_string0, True, BLACK)
    text1= font.render(draw_string1, True, BLACK)
    screen.blit (text0,(200,20))
    screen.blit (text1,(400,20))
    pygame.display.update()
    clock.tick(0.25)
pygame.quit()
    
